package com.raja.requestForwarding.mq.connect;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * Created by liuyanjun
 * on 2017/8/16/016.
 */
@Component
public class CustomConnection {
    private static final Logger log = LoggerFactory.getLogger(CustomConnection.class);
    public Connection connection = null;
    /**
     * 获取连接
     * @param factory
     * @return
     * @throws Exception
     */
    public  Connection getConnection(ConnectionFactory factory) throws Exception{
            connection = factory.newConnection();
        return connection;
    }
}
